<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Created by PhpStorm.
 * User: gavin
 * Date: 15-5-10
 * Time: 下午3:31
 */

class Xueme_course_model extends CI_Model
{

    public function __construct()
    {
        parent::__construct();
        //装载database
        $this->load->database();
    }

    public function insert($coursename,$info=null,$other=null)
    {
        $value['coursename'] = $coursename;
        $value['info'] = $info;
        $value['other'] = $other;
        $this->db->insert('xueme_course',$value);
    }

    public function getCourses()
    {
        $sql = sprintf("select * from %s ORDER BY cd",'xueme_course');
        $query = $this->db->query($sql);
        return $query->result();
    }
}
